import com.Darkra1Zzz.entity.*;
import com.Darkra1Zzz.service.AdminService;
import com.Darkra1Zzz.service.MainService;
import com.Darkra1Zzz.service.SongService;
import com.Darkra1Zzz.service.UserService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author Darkrai
 * @Date: 2021/6/16 17:26
 * @Version 1.0
 */
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("/applicationContext.xml")
public class MyTest2 {
    @Resource
    private MainService mainService;

    @Resource
    private AdminService adminService;

    @Resource
    private SongService songService;

    @Resource
    private UserService userService;

    @Test
    public void test1(){
        List<Type> industryList=mainService.queryAllHangYe();
        for (Type i:industryList){
            System.out.println(i);
        }
    }


    @Test
    public void test2(){
        Admin admin=adminService.login("123","123");
        System.out.println(admin);
    }


    @Test
    public void test3(){
        List<Song> list=songService.querySongs();
        for (Song i:list){
            System.out.println(i);
        }
    }

    @Test
    public void test4(){
        Song song=new Song();
        Type type=new Type();
        type.setName("说唱");
        Singer singer=new Singer();
        singer.setName("");
        song.setType(type);
        song.setSinger(singer);
        PageInfo<Song> list=songService.querySongsByCondition(song,1,3);
        List<Song> songList=list.getList();
        for (Song i:songList){
            System.out.println(i);
        }
    }


    //测试user 增删改
    @Test
    public void test5(){
        User user=new User();
        user.setName("测试添加用户");
        user.setEmail("9999@qq.com");
        user.setPhone("123123");
        user.setPwd("123456");
        userService.addUser(user);
    }
}
